" 
"      _                           _                     _           
"  ___| |__   __ _ _ __   __ _    (_)_   _ _ __   __   _(_)_ __ ___  
" |_  / '_ \ / _` | '_ \ / _` |   | | | | | '_ \  \ \ / / | '_ ` _ \ 
"  / /| | | | (_| | | | | (_| |   | | |_| | | | |  \ V /| | | | | | |
" /___|_| |_|\__,_|_| |_|\__, |  _/ |\__,_|_| |_|   \_/ |_|_| |_| |_|
"                        |___/  |__/                                 

let mapleader=" "
syntax on


set nocompatible

" 识别不同文件格式
filetype on
filetype indent on
filetype plugin on
filetype plugin indent on

" 设置鼠标
" set mouse=a

" 设置中文编码
set encoding=utf-8

" let &t_ut=''

" 设置tab
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4

set list
" set listchars=tab:\ ,trail:
set scrolloff=5 " 始终显示最上面和最下面五行
set tw=0
set indentexpr=

" 设置退格键
set backspace=indent,eol,start

" 折叠代码
set foldmethod=indent
set foldlevel=99

" 修改光标在模式下的显示
" let &t_SI = "\<Esc>]50;CursorShape=1\x7"
" let &t_SR = "\<Esc>]50;CursorShape=2\x7"
" let &t_EI = "\<Esc>]50;CursorShape=0\x7"

set laststatus=2
set autochdir

" 每次打开文件回到上一次编辑位置
au BufReadPost * if line("''\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif


" base setting
set number
set norelativenumber
set cursorline
set wrap
set showcmd
set wildmenu

set hlsearch
exec "nohlsearch"
set incsearch
set ignorecase
set smartcase

" ctags
set tags=tags

" c/c++ format
set autoindent
set cindent


" 光标移动
noremap U 5k
noremap E 5j


noremap n nzz
noremap N Nzz

noremap <LEADER><CR> :nohlsearch<CR>


map s <nop>
map S :w<CR>
map Q :q<CR>
map R :source /root/.vim/vimrc<CR>

" 分屏
map si :set splitright<CR>:vsplit<CR>
map sn :set nosplitright<CR>:vsplit<CR>
map su :set nosplitbelow<CR>:split<CR>
map se :set splitbelow<CR>:split<CR>

" 分屏跳转
map <LEADER>l <C-w>l
map <LEADER>h <C-w>h
map <LEADER>j <C-w>j
map <LEADER>k <C-w>k

" 分屏大小调节
map <up> :res +5<CR>
map <down> :res -5<CR>
map <left> :vertical resize-5<CR>
map <right> :vertical resize+5<CR>

" 左右分屏和上下分屏切换
map sv <C-w>t<C-w>H
map sh <C-w>t<C-w>K

" 标签页
map tu :tabe<CR>
map tn :tabn<CR>
map tp :tabp<CR>

" 拼写检查
map <LEADER>sc :set spell!<CR>

" call figlet
map tx :r !figlet 


call plug#begin()

Plug 'vim-airline/vim-airline'
Plug 'connorholyday/vim-snazzy'

call plug#end()

color darkblue 

